<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<title><?php if(isset($seo_title) && isset($site_title) && ($seo_title == $site_title)){?><?php echo isset($seo_title)?$seo_title:"";?><?php }else{?><?php echo isset($seo_title)?$seo_title:"";?>-<?php echo isset($site_title)?$site_title:"";?><?php }?></title>
	<link type="image/x-icon" href="<?php echo urldecode(Url::urlFormat("@favicon.ico"));?>" rel="icon">
	<link type="text/css" rel="stylesheet" href="<?php echo urldecode(Url::urlFormat("#css/common.css"));?>" />
	<link type="text/css" rel="stylesheet" href="<?php echo urldecode(Url::urlFormat("#css/simple.css"));?>" />
	<?php echo JS::import('jquery');?>
	<script type='text/javascript' src="<?php echo urldecode(Url::urlFormat("#js/common.js"));?>"></script>
	<!--[if IE 6]>
		<script src="<?php echo urldecode(Url::urlFormat("#js/DD_belatedPNG-min.js"));?>"></script>
		<script>DD_belatedPNG.fix('.ie6png');</script>
	<![endif]-->
</head>
<body class="screen_960">
	<!--S 头部 -->
	<div id="header" class="clearfix">
		<div class="header-main" style="border-bottom:#7c0000 2px solid;">
			<div class="wrap">
				<div class="logo "><a href="<?php echo urldecode(Url::urlFormat("/index/index"));?>"><img class="ie6png" src="<?php echo urldecode(Url::urlFormat("@$site_logo"));?>" style="max-height:74px;"></a></div>
			</div>
		</div>
	</div>
	<!--E 头部 -->
	<!--S content-->
	<div id="content">
		<div class="wrap">
		<?php if(isset($msg)){?>
		<div class="message-box mt5" >
			<div class="message-head"><div class="message_<?php echo isset($msg[0])?$msg[0]:"";?> ie6png"><?php echo isset($msg[1])?$msg[1]:"";?></div><i class="fail "></i></div>
			<div class="message-content">
			</div>
		</div>
		<?php }?>
			<?php echo JS::import('form');?>
<?php echo JS::import('dialog?skin=simple');?>
<?php echo JS::import('dialogtools');?>
<div class="mt20 login box clearfix">
	<div class="head">用户注册</div>
<div class="fl login-form mt20">
	<form action="<?php echo urldecode(Url::urlFormat("/simple/reg_act"));?>" method="post" callback="checkReadme">
		<dl class="clearfix">
			<dt>电子邮箱：</dt><dd><input class="input"  name="email" id="email"  pattern="email" alt="邮箱(例如:demo@tinyx.com)"><label></label></dd>
		</dl>
		<dl class="clearfix">
			<dt>密&nbsp;&nbsp;&nbsp;&nbsp;码：</dt><dd><input type="password" bind="repassword" minlen=6 maxlen=20 class="input" name="password" pattern="required" alt="6-20任意字符组合"><label></label></dd>
		</dl>
		<dl class="clearfix">
			<dt>确认密码：</dt><dd><input type="password"  minlen=6 maxlen=20  bind="password" class="input" name="repassword" pattern="required" alt="6-20任意字符组合"><label></label></dd>
		</dl>
		
		<?php if(class_exists('SMS') && SMS::getInstance()->getStatus()){?>
		<dl class="clearfix">
			<dt>手机号：</dt><dd><input type="text" id="mobile" class="input" name="mobile" pattern="mobi" value="<?php echo isset($mobile)?$mobile:"";?>" alt="正确的手机号码"><label></label></dd>
		</dl>
		<dl class="clearfix">
			<dt>短信验证码：</dt><dd><input type="text" class="input small" name="mobile_code" pattern="\d{6}"><label></label><input id="sendSMS" type="button" class="btn btn-gray" value="获取短信验证码"></dd>
		</dl>
		<?php }else{?>
		<dl class="clearfix">
			<dt>验证码：</dt><dd style="height:40px;"><input type="text" class="input" name="verifyCode" id="verifyCode"  pattern="\w{4}" maxlength="4" style="width: 80px;" ><img id="captcha_img"  src="<?php echo urldecode(Url::urlFormat("/simple/captcha/h/40/w/120"));?>"><label><a href="javascript:void(0)" class="red" onclick="document.getElementById('captcha_img').src='<?php echo urldecode(Url::urlFormat("/simple/captcha/h/40/w/120/random/"));?>'+Math.random()">换一张</a></label></dd>
		</dl>
		<?php }?>
		<dl class="clearfix">
			<dt>&nbsp;</dt><dd><input id="readme" type="checkbox"><label></label><label>我已阅读并同意《<a class="red" id="user-license" href="javascript:;"><?php echo isset($site_title)?$site_title:"";?>用户注册协议</a>》</label></dd>
		</dl>
		<dl class="clearfix">
			<dt></dt><dd style="padding-left:200px;"><input type="submit" class="btn" value="同意协议，立即注册"></dd>
		</dl>
		<input type='hidden' name='tiny_token_reg' value='<?php echo Tiny::app()->getToken("reg");?>'/>
	</form>
</div>
<div class="login-note mt20">
	<ul>
		<li><h1>我已经注册， <a href="<?php echo urldecode(Url::urlFormat("/simple/login"));?>" class="red">登录</a></h1></li>
	</ul>
</div>
</div>
<div id="license-content" style="display:none;">
	<div style="height:400px;overflow:auto">
	<?php $item=null; $query = new Query("help");$query->where = "id = 14";$items = $query->find(); foreach($items as $key => $item){?>
	<?php echo isset($item['content'])?$item['content']:"";?>
	<?php }?>
	</div>
	<div class="mt20 tc"><a href="javascript:closeLicense();" class="btn">同意用户注册协议</a></div>
</div>
<script type="text/javascript">
	$("#user-license").on("click",function(){
		art.dialog({id:'license-dialog',opacity:0.3,padding:'20px 10px 10px 20px',width:900,height:400,title:'用户注册协议',content:document.getElementById('license-content'),lock:true});
	});

	function closeLicense(){
		$('#readme').attr("checked",'true');
		autoValidate.showMsg({id:document.getElementById('readme'),error:false,msg:''});
		art.dialog({id:'license-dialog'}).close();
	}

	$("#sendSMS").click(function(){

		var data = 'mobile=' + $("#mobile").val()+'&r=' + Math.random();
		if(autoValidate.validate(document.getElementById('mobile'))===false)return;

		$.ajax({
			type: "get",
			url: "<?php echo urldecode(Url::urlFormat("/ajax/send_sms"));?>",
            data: data,
            dataType:'json',
            success:function(result){
            	if(result['status']=='success'){
            		$('#mobile').attr("disabled", "disabled");
            		var send_sms = $("#sendSMS");
            		send_sms.attr("disabled",true);
            		send_sms.addClass("btn-disable");
            		var i = 120;
                    send_sms.val(i + '秒后重新获取');
                    var timer = setInterval(function () {
                        i--;
                        send_sms.val(i + '秒后重新获取');
                        if (i <= 0) {
                            clearInterval(timer);
                            send_sms.val('获取短信验证码');
                            $('#mobile').attr("disabled", "");
                            send_sms.removeClass("btn-disable");
                            send_sms.attr("disabled",false);
                        }
                    }, 1000);
            	}else{
            		art.dialog.tips("<p class='fail'>"+result['msg']+"</p>");
            	}
            }
        });
	});

	$("input[name='email']").on("change",function(event){
		if(autoValidate.validate(event)){
			$.post("<?php echo urldecode(Url::urlFormat("/ajax/email/email/"));?>"+$(this).val(),function(data){
			autoValidate.showMsg({id:document.getElementById('email'),error:!data['status'],msg:data['msg']});
		},'json');
		}
	})
	$("input[name='verifyCode']").on("change",function(){
		$.post("<?php echo urldecode(Url::urlFormat("/ajax/verifyCode/verifyCode/"));?>"+$(this).val(),function(data){
			autoValidate.showMsg({id:document.getElementById('verifyCode'),error:!data['status'],msg:data['msg']});
		},'json');
	})
	$("#readme").on("change",function(){
		if($("#readme:checked").length>0)autoValidate.showMsg({id:document.getElementById('readme'),error:false,msg:''});
		else autoValidate.showMsg({id:document.getElementById('readme'),error:true});
	});
	function checkReadme(e){
		if(e) return false;
		else{
			if($("#readme:checked").length>0)return true;
			{
				autoValidate.showMsg({id:document.getElementById('readme'),error:true});
				return false;
			}
		}
	}
	<?php if(isset($invalid)){?>
		var form = new Form();
		form.setValue('email', '<?php echo isset($email)?$email:"";?>');
		autoValidate.showMsg({id:$("input[name='<?php echo isset($invalid['field'])?$invalid['field']:"";?>']").get(0),error:true,msg:"<?php echo isset($invalid['msg'])?$invalid['msg']:"";?>"});
	<?php }?>
</script>
		</div>
	</div>
	<!--E content-->
	<!--S 底部 -->
	<div id="footer" class="mt20  ">
		<div class="wrap">
			<div class="copyright" style="border: 0">
				<div><?php $item=null; $query = new Query("nav");$query->where = "type = 'bottom'";$query->order = "`sort` desc";$items = $query->find(); foreach($items as $key => $item){?>
					<a href="<?php if(strstr($item['link'],'http://')===false){?><?php echo urldecode(Url::urlFormat("$item[link]"));?><?php }else{?><?php echo isset($item['link'])?$item['link']:"";?><?php }?>" target="<?php if($item['open_type']==1){?>_blank<?php }else{?>_self<?php }?>"><?php echo isset($item['name'])?$item['name']:"";?></a>
					<?php }?></div>
					<!--S 济南泰创软件科技有限公司保留所有版权，非授权用户严禁删除版权信息；擅自删除，后果自负，您的支持是我们成长的动力。-->
					<div><span>Powered by <a href="http://www.tinyrise.com"><b style="color: #7c0000">Tiny</b><b style="color: #666">Shop</b></a></span> © 2014 <a href="http://www.tinyrise.com">tinyrise.com</a> . 保留所有权利 。<?php echo isset($site_icp)?$site_icp:"";?> </div>
					<!--S 济南泰创软件科技有限公司保留所有版权，非授权用户严禁删除版权信息；擅自删除，后果自负，您的支持是我们成长的动力。-->
			</div>
		</div>

	</div>
	<!--E 底部 -->
</body>
</html>
<!--Powered by TinyRise-->